package org.example.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.example.entity.ClassQuestion;
import org.example.mapper.ClassQuestionMapper;
import org.example.service.ClassQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * @ClassName ClassQuestionServiceImpl
 * @Description TODO
 * @Author qiuye
 * @Date 2025年08月18日 15:53
 * @Version 1.0
 */
@Service
public class ClassQuestionServiceImpl implements ClassQuestionService {
    @Autowired
    private ClassQuestionMapper classQuestionMapper;


    @Override
    public PageInfo<ClassQuestion> getClassQuestion(ClassQuestion classQuestion, int page, int size) {
        PageHelper.startPage(page, size);
        List<ClassQuestion> list = classQuestionMapper.getClassQuestion(classQuestion);
        PageInfo<ClassQuestion> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public PageInfo<ClassQuestion> getClassQuestionCount(ClassQuestion classQuestion, int page, int size) {
        PageHelper.startPage(page, size);
        List<ClassQuestion> list = classQuestionMapper.getClassQuestionCount(classQuestion);
        PageInfo<ClassQuestion> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public PageInfo<ClassQuestion> getClassQuestionHui(ClassQuestion classQuestion, int page, int size) {
        PageHelper.startPage(page, size);
        List<ClassQuestion> list = classQuestionMapper.getClassQuestionHui(classQuestion);
        PageInfo<ClassQuestion> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
